/*
 * @Author: mikey.zhaopeng 
 * @Date: 2019-01-01 20:59:16 
 * @Last Modified by: mikey.zhaopeng
 * @Last Modified time: 2019-01-01 21:22:57
 */
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:flutter/material.dart';



class TcSwiper extends StatelessWidget{
  final List<Map> sliderData;
  TcSwiper({Key key,this.sliderData}):super(key:key);

  @override
  Widget build(BuildContext context){
    return AspectRatio(
        aspectRatio: 2.4 / 1,
        child: new Swiper(
          itemBuilder: (BuildContext context, int index) {
            String imgurl = sliderData[index]['path'];
            return new Image.asset(
              // "assets/images/discount/slider1.png",
              imgurl,
              fit: BoxFit.fill,
            );
          },
          itemCount: sliderData.length,
          onTap: (int index){
            print(sliderData[index]['gameId']);
          },
          pagination: new SwiperPagination(builder: SwiperCustomPagination(
              builder: (BuildContext context, SwiperPluginConfig config) {
            return new ConstrainedBox(
              child: new Row(
                children: <Widget>[
                  new Expanded(
                    child: new Align(
                      alignment: Alignment.center,
                      child: new DotSwiperPaginationBuilder(
                        color: Colors.white,
                        activeColor: Color(0xfffe5ba8),
                        size: 10.0,
                        // activeSize: 20.0,
                      ).build(context, config),
                    ),
                  )
                ],
              ),
              constraints: new BoxConstraints.expand(height: 20.0),
            );
          })),
          // control: new SwiperControl(),
        ),
      );
  }
}